using System;

namespace Framework.Library.Core.Utils.Security
{
    public class Generate
    {
        public static string RandomString(int length)
        {
            string str = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
            int strlen = str.Length;
            var rnd = new Random();
            string retVal = String.Empty;

            for (int i = 0; i < length; i++)
                retVal += str[rnd.Next(strlen)];

            return retVal;
        }

        public static string RandomPasword(int length)
        {
            string valid = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!#%&()@${[]}";
            string res = "";
            var rnd = new Random();
            while (0 < length--)
                res += valid[rnd.Next(valid.Length)];
            return res;
        }

        public static string RandomNumber(int length)
        {
            string retVal = String.Empty;
            var rd = new Random();
            for (int i = 1; i < length; i++)
            {
                retVal += rd.Next(0, 9);
            }
            return retVal;
        }
    }
}